<?php
	function InstallerSetIntallerStepsHook()
	{
		$step = new InstallerStep(array("view_file"=>"welcome"));
		Installer::addStep($step,"intro",1);
		$step = new InstallerStep(array("view_file"=>"system_settings",'title'=>"System Settings"));
		Installer::addStep($step,"system_setting",2);
		$step = new InstallerStep(array("view_file"=>"system_installed",'title'=>"Finish Installation"));
		//setting it 100 as for last step
		Installer::addStep($step,"system_installed",100);
		
	}
	
	function InstallerAfterBootstrapHook()
	{
		require_once(INSTALLER_VENDORS_PATH . 'installer.php');
	}
	function InstallerInitHook($controller)
	{
		//App::import("Vendor","Installer.Installer");
		
		
		$url = array("controller"=>@$controller->params['controller'],'action'=>@$controller->params['action'],'plugin'=>@$controller->params['plugin']);
		if(Installer::isInstalled() == false)
		{
			//hooks to collect steps.
			callHooks('setIntallerSteps','.+',$controller);
			if(Installer::isInstallUrl($url) == false)
			{
				$controller->redirect(Installer::$intallUrl);
			}
		}else
		{
			//at install url when system is installed.
			if(Installer::isInstallUrl($url) == true)
			{
				die("System is already installed.");
			}
			Configure::write('cmsInstalled', true);
		}
	}
?>